package br.com.peri.repository.bean;

import javax.persistence.NoResultException;
import javax.persistence.Query;

import br.com.peri.StatusDigitalUsuarioPlano;
import br.com.peri.repository.UsuarioRepository;

public class UsuarioRepositoryBean extends PeriRepositoryBean implements
		UsuarioRepository {

	private static final long serialVersionUID = 1L;

	@Override
	public StatusDigitalUsuarioPlano getStatusDigital(String cpfCnpj) {
		Query query = entityManager
				.createNamedQuery("StatusDigitalUsuarioPlano.listarStatusPorNomePessoa");
		query.setParameter("cpfCnpj", cpfCnpj);
		Object result = null;
		try {
			result = query.getSingleResult();
		} catch (NoResultException e) {
			// nada a fazer
		}
		return result == null ? null : (StatusDigitalUsuarioPlano) result;
	}
}
